/**
 * 两种操作：
 * 1 把ai换成x
 * 2 把所有ai换成x
 * 每次操作之后求和，简单的算一下就行
 * 这里用了线段树
 */
#include <bits/stdc++.h>
using namespace std;
 
char *__abc147, *__xyz258, __ma369[100000];
#define __hv007() ((__abc147==__xyz258) && (__xyz258=(__abc147=__ma369)+fread(__ma369,1,100000,stdin),__abc147==__xyz258) ? EOF : *__abc147++)
 
int getInt(){
	int sgn = 1;
	char ch = __hv007();
	while( ch != '-' && ( ch < '0' || ch > '9' ) ) ch = __hv007();
	if ( '-' == ch ) {sgn = 0;ch=__hv007();}
 
	int ret = (int)(ch-'0');
	while( '0' <= (ch=__hv007()) && ch <= '9' ) ret = ret * 10 + (int)(ch-'0');
	return sgn ? ret : -ret;
}
 
#ifndef ONLINE_JUDGE
int const SIZE = 6;
#else
int const SIZE = 2E5+5;
#endif
 
using llt = long long;
using Real = long double;
using vi = vector<int>;
using pii = pair<int, int>;

llt St[SIZE<<2];
llt Lazy[SIZE<<2];

inline int lson(int t){return t<<1;}
inline int rson(int t){return lson(t)|1;}

inline void _pushUp(int t){
	St[t] = St[lson(t)] + St[rson(t)];
}

inline void _pushDown(int t, int s, int e){
	if(0 == Lazy[t]) return;
	
	llt & lazy = Lazy[t];
    int m = (s + e) >> 1;

    int son = lson(t);
	St[son] = (m - s + 1) * lazy;
    Lazy[son] = lazy;

	son = rson(t);
	St[son] = (e - m) * lazy;
	Lazy[son] = lazy;

	lazy = 0;
}

void modify(int t, int s, int e, int pos, llt v){
	if(s == e){
		St[t] = v;
		Lazy[t] = v;
		return;
	}

	_pushDown(t, s, e);
	int m = (s + e) >> 1;
	if(pos <= m) modify(lson(t), s, m, pos, v);
	else modify(rson(t), m+1, e, pos, v);
	_pushUp(t);
}

void modify(int t, int s, int e, int a, int b, llt v){
	if(a <= s && e <= b){
		St[t] = (e - s + 1) * v;
		Lazy[t] = v;
		return;
	}

	_pushDown(t, s, e);
	int m = (s + e) >> 1;
	if(a <= m) modify(lson(t), s, m, a, b, v);
	if(m < b) modify(rson(t), m+1, e, a, b, v);
	_pushUp(t);	
}

llt query(int t, int s, int e, int a, int b){
	if(a <= s && e <= b){
		return St[t];
	}

	_pushDown(t, s, e);
	int m = (s + e) >> 1;
	llt ans = 0;
	if(a <= m) ans += query(lson(t), s, m, a, b);
	if(m < b) ans += query(rson(t), m+1, e, a, b);
	return ans;
}

void build(int t, int s, int e){
	Lazy[t] = 0;
	if(s == e){
		St[t] = getInt();
		return;
	}

	int m = (s + e) >> 1;
	build(lson(t), s, m);
	build(rson(t), m+1, e);
	_pushUp(t);
}

int N, Q;

int main(){
#ifndef ONLINE_JUDGE
    freopen("1.txt", "r", stdin);
#endif
    N = getInt();
	Q = getInt();
	build(1, 1, N);
    for(int q=1;q<=Q;++q){
		int cmd = getInt();
		if(1 == cmd){
            int pos = getInt();
			llt x = getInt();
            modify(1, 1, N, pos, x);
			printf("%lld\n", query(1, 1, N, 1, N));
		}else{
            llt x = getInt();
            modify(1, 1, N, 1, N, x);
			printf("%lld\n", query(1, 1, N, 1, N));
		}
	}
    return 0;
}